package javaapplication1;

import java.awt.Rectangle;
import javax.swing.JFrame;

/**
 *
 * @author Beheerder
 */
public class Main
{
    /**
     *
     * @param args
     */
    public static void main(String[] args)
    {
        System.out.println("Systemout");
        PrintFace();
        HelloPrinter();
        FacePrinter();
        Sum10(10);
        SumReciprocals(10);
        SelfCheck();
        Average(10, 1.22);
        MoveTester(5,10,20,30,15,25);
        UserInterface();

    }
    
    /**
     *
     */
    public static void PrintFace()
    {
        System.out.println("Face");
    }

    /**
     * 
     */
    public static void HelloPrinter()
    {
        System.out.println("Hello");
        System.out.println("World!");
    }

    /**
     *
     */
    public static void FacePrinter()
    {
        System.out.println("  /////");
        System.out.println("|  o o  |");
    }

    /**
     *
     * @param max
     * @return
     */
    public static int Sum10(int max)
    {
        int sum = 0;
        int index = 0;
        while(index <= max)
        {
            sum = sum + index;
            index++;
        }
        System.out.println(sum);
        return sum;
    }

    /**
     *
     * @param max
     */
    public static void SumReciprocals(int max)
    {
        double sum = 0.0;
        double index = 0.0;
        while(index <= max)
        {
            sum = 1.0 / index + sum;
            index++;
        }
        System.out.println(sum);
    }

    /**
     *
     */
    public static void SelfCheck()
    {
        String word = "Mississippi";
        System.out.println(word.length());
        System.out.println(word.toUpperCase());
        System.out.println(word.replace("issipp" , "our"));
        System.out.println(word.replace("s" , "p"));
        double dos = 124389.288;
        System.out.println(dos);
        System.out.println(word.toLowerCase());
    }

    /**
     *
     * @param first
     * @param second
     */
    public static void Average(double first, double second)
    {
        double sum = first + second;
        System.out.println(sum / 2);
    }

    /**
     *
     * @param x
     * @param y
     * @param width
     * @param length
     * @param xtrans
     * @param ytransf
     */
    public static void MoveTester(int x, int y, int width, int length, int xtrans, int ytransf)
    {
        Rectangle box = new Rectangle(x,y,width,length);
        box.translate(xtrans, ytransf);
        System.out.println(box.getX()+ " "+box.getY());

        
    }

    /**
     *
     */
    public static void UserInterface()
    {
        JFrame frame = new JFrame();
        JFrame frame2 = frame;
        JFrame frame3 = new JFrame();
        frame.setSize(300, 400);
        frame.setTitle("An empty frame");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
        frame3.setSize(500, 500);
        frame3.setTitle("An empty frame3");
        frame3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame3.setVisible(true);
        frame2.setSize(10, 10);
        //RectangleComponent component = new RectangleComponent();
        //frame.add(component);
    }

    }


